package models

import "gorm.io/gorm"

type Novels struct {
	gorm.Model
	Title  string `gorm:"type:varchar(100)" json:"title"`
	Author string `gorm:"type:varchar(100)" json:"author"`
	Commit string `gorm:"type:varchar(100)" json:"commit"`
}

// 添加
func (n *Novels) Add() error {
	return DB.Create(&n).Error
}

// 删除
func (n *Novels) Del() error {
	return DB.Delete(&n).Error
}

// 修改
func (n *Novels) Up() error {
	return DB.Save(&n).Error
}
